#include "clight.h"
#include <GL/glu.h>

CLight::CLight()
{
}

CLight::CLight(CPoint3f pos, float r, float g, float b)
{
    this->m_Position = pos;
    this->m_fRed = r;
    this->m_fGreen = g;
    this->m_fBlue = b;
}

void CLight::paint()
{
    glPushMatrix();
            glTranslatef(this->m_Position.GetX(), this->m_Position.GetY(), this->m_Position.GetZ());
            GLUquadric *quadric;
            quadric = gluNewQuadric();
            gluQuadricDrawStyle(quadric, GLU_FILL);
            gluQuadricNormals(quadric, GLU_SMOOTH);
            /* If we ever changed/used the texture or orientation state
            of quadObj, we'd need to change it to the defaults here
            with gluQuadricTexture and/or gluQuadricOrientation. */
            gluSphere(quadric, 10, 32, 32);

            glDisable(GL_LIGHTING);
            glColor3f(this->m_fRed, this->m_fGreen, this->m_fBlue);
            glBegin(GL_LINES);
                    glVertex3f(-50.0f, 0.0f, 0.0f);
                    glVertex3f(50.0f, 0.0f, 0.0f);
            glEnd();

            glBegin(GL_LINES);
                    glVertex3f(0.0f, -50.0f, 0.0f);
                    glVertex3f(0.0f, 50.0f, 0.0f);
            glEnd();

            glBegin(GL_LINES);
                    glVertex3f(0.0f, 0.0f, -50.0f);
                    glVertex3f(0.0f, 0.0f, 50.0f);
            glEnd();
            glEnable(GL_LIGHTING);

    glPopMatrix();
}
